layui.use(['form', 'table', 'laydate'], function () {
    var form = layui.form;
    var $ = layui.$;
    var table = layui.table,
        laydate = layui.laydate;

    table.render({
        elem: '#dataTable'
        , url: '/logs/getLoginLogData'
        , contentType: "application/json"
        , height: 'full-110'
        , loading: true
        , size: 'sm'
        , method: 'POST'
        , where: {}
        , page: true
        , limit: 50
        , cols: [
            [
                {field: 'createTime', fixed: 'left', title: '时间', width: '150'}
                , {field: 'userCode', fixed: 'left', title: '用户', width: '100'}
                , {field: 'ip', title: 'IP地址', width: '150'}
                , {field: 'operatingSystem', title: '操作系统', width: '100'}
                , {field: 'browser', title: '浏览器', width: '100'}
                , {field: 'browserVersion', title: '浏览器版本', width: '100'}
                , {field: 'event', title: '日志', width: '450'}
                , {field: 'access', title: '结果', width: '100'}
            ]
        ]
    });

    laydate.render({
        elem: '#stime'
        , type: 'datetime'
    });
    laydate.render({
        elem: '#etime'
        , type: 'datetime'
    });

    form.on('submit(search)', function (data) {
        console.log(data)
        table.reload('dataTable', {
            url: '/log/loginLogData'
            , type: 'post'
            , where: data.field
            , page: true
            , limit: 50
            , loading: true
        });
        return false;
    });


});